import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const queryGeneralOrgInfo = (params) => {
  params.head.transCode = 'queryGeneralOrgInfo';
  return request({
    url: '/general/generalOrgInfo/queryGeneralOrgInfo',
    method: 'post',
    data: params
  })
}

//单条查询
export const queryGeneralOrgTree = (params) => {
  params.head.transCode = 'queryGeneralOrgTree';
  return request({
    url: '/general/generalOrgInfo/queryGeneralOrgTree',
    method: 'post',
    data: params
  })
}

//多条列表查询，支持条件查询
export const queryGeneralOrgInfoListPage = (params) => {
  params.head.transCode = 'queryGeneralOrgInfoListPage';
  return request({
    url: '/general/generalOrgInfo/queryGeneralOrgInfoListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveGeneralOrgInfo = (params) => {
  params.head.transCode = 'saveGeneralOrgInfo';
  return request({
    url: '/general/generalOrgInfo/saveGeneralOrgInfo',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveGeneralOrgInfoList = (params) => {
  params.head.transCode = 'saveGeneralOrgInfoList';
  return request({
    url: '/general/generalOrgInfo/saveGeneralOrgInfoList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateGeneralOrgInfo = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralOrgInfo';
  return request({
    url: '/general/generalOrgInfo/saveOrUpdateGeneralOrgInfo',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateGeneralOrgInfoList = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralOrgInfoList';
  return request({
    url: '/general/generalOrgInfo/saveOrUpdateGeneralOrgInfoList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateGeneralOrgInfo = (params) => {
  params.head.transCode = 'updateGeneralOrgInfo';
  return request({
    url: '/general/generalOrgInfo/updateGeneralOrgInfo',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteGeneralOrgInfo = (params) => {
  params.head.transCode = 'deleteGeneralOrgInfo';
  return request({
    url: '/general/generalOrgInfo/deleteGeneralOrgInfo',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteGeneralOrgInfoList = (params) => {
  params.head.transCode = 'deleteGeneralOrgInfoList';
  return request({
    url: '/general/generalOrgInfo/deleteGeneralOrgInfoList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportGeneralOrgInfoExcel = (params) => {
  downloadExcel({
    url: '/general/generalOrgInfo/excelDownload/exportGeneralOrgInfoExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
